FROM node:22-alpine AS build
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
	npm config set registry https://registry.npmmirror.com && \
	export NODE_OPTIONS=--openssl-legacy-provider
WORKDIR /src
COPY . .
RUN npm instal && npm run build

FROM nginx:alpine as base
WORKDIR /app
COPY . .

FROM build AS publish

CMD ["node", "/app/src/index.js"]